_min_caml_start → min_caml_start 対応
(私的メモ)
macOSではシンボルの前のアンダーバーがついていたので AArch64 対応にあわせて _min_caml_start のようにアンダーバーをつけていたのだけど、macOS以外のターゲットでは不要だったので取り除くことにした。
code:diff
diff --git a/RV32/emit.ml b/RV32/emit.ml
index 6200ead..e867ce5 100644
--- a/RV32/emit.ml
+++ b/RV32/emit.ml
@@ -304,10 +304,10 @@ let f oc (Prog(data, fundefs, e)) =
Printf.fprintf oc "\t.long\t%ld\n" (getlo d))
data);
Printf.fprintf oc "\t.text\n";
- Printf.fprintf oc "\t.globl _min_caml_start\n";
+ Printf.fprintf oc "\t.globl min_caml_start\n";
Printf.fprintf oc "\t.align 2\n";
List.iter (fun fundef -> h oc fundef) fundefs;
- Printf.fprintf oc "_min_caml_start: # main entry point\n";
+ Printf.fprintf oc "min_caml_start: # main entry point\n";
(* sp と hp を設定 *)
Printf.fprintf oc "\tmv %s, %s\n" (reg reg_sp) (reg "%a0");
diff --git a/closure.ml b/closure.ml
index 14b035c..e47539c 100644
--- a/closure.ml
+++ b/closure.ml
@@ -98,7 +98,7 @@ let rec g env known = function (* クロージャ変換ルーチン本体 (caml2
| KNormal.Get(x, y) -> Get(x, y)
| KNormal.Put(x, y, z) -> Put(x, y, z)
| KNormal.ExtArray(x) -> ExtArray(Id.L(x))
- | KNormal.ExtFunApp(x, ys) -> AppDir(Id.L("_min_caml_" ^ x), ys)
+ | KNormal.ExtFunApp(x, ys) -> AppDir(Id.L("min_caml_" ^ x), ys)
let f e =
toplevel := [];
diff --git a/stub.c b/stub.c
index 1648df9..8ed8d00 100644
--- a/stub.c
+++ b/stub.c
@@ -2,9 +2,7 @@
-extern int min_caml_start(char *, char *) asm ("_min_caml_start");
-extern void min_caml_print_int(int) asm ("_min_caml_print_int");
-extern void min_caml_print_newline() asm ("_min_caml_print_newline");
+extern int min_caml_start(char *, char *);
// static FILE *fp;